/*
 * @Author: your name
 * @Date: 2021-01-21 22:29:41
 * @LastEditTime: 2021-01-26 00:18:56
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \ad-api\dao\pageDao.js
 */
const { querySql } = require('../db')
module.exports = {
  // 获取页面列表
  getPageListDao: async (page_id) => {
    const sql = page_id ? `select * from pages where id='${page_id}'` : 'select * from pages'
    return await querySql(sql)
  },
  //添加页面
  async addPageDao(pageInfo) {
    const { page_name, page_comment, page_route, page_path } = pageInfo
    const sql = `insert into pages (page_name ,page_comment ,page_route ,page_path ) values ('${page_name}','${page_comment}','${page_route}','${page_path}')`
    return await querySql(sql)
  },
  async delPageDao(page_id) {
    const sql = `delete from pages where id='${page_id}'`
    return await querySql(sql)
  }
}

